var log4js = require('log4js');
log4js.configure({
    appenders: {
        ruleConsole: {type: 'console'},
        ruleFile: {
            type: 'dateFile',
            filename: __dirname + '/logs/info-',
            pattern: 'yyyy-MM-dd.log',
            maxLogSize: 10 * 1000 * 1000,
            numBackups: 3,
            alwaysIncludePattern: true
        },
        errFile : {
            type: 'dateFile',
            filename: __dirname + '/logs/err-',
            pattern: 'yyyy-MM-dd.log',
            maxLogSize: 10 * 1000 * 1000,
            numBackups: 3,
            alwaysIncludePattern: true
        }
    },
    //这里配置两级 info和error 其余方式输出日志将被忽略
    categories: {
        default: {appenders: ['ruleConsole', 'ruleFile'], level: 'info'},
        error : {appenders: ['ruleConsole', 'errFile'], level: 'error'},
    }

});
const logManager = {
    info : log4js.getLogger('default'),
    error : log4js.getLogger('error')
}
module.exports = {
    INFO : logManager.info.info.bind(logManager.info),
    ERROR : logManager.error.error.bind(logManager.error)
}